﻿using Microsoft.Extensions.Logging;
using Quartz;
using System.Configuration;
using System.Text;

namespace LaserAutoTest.Worker.Jobs
{
    public class HCJob : IJob
    {
        private readonly ILogger _logger;
        private readonly SemaphoreSlim _semaphoreSlim = new SemaphoreSlim(1, 1);

        public HCJob(ILogger logger)
        {
            _logger = logger;
        }
        public async Task Execute(IJobExecutionContext context)
        {
            // 等待获取锁
            await _semaphoreSlim.WaitAsync();
            await Test();
            _semaphoreSlim.Release();

        }

        private async Task Test()
        {
            _logger.LogInformation("Test");
        }
    }
}
